import java.lang.String;

public class nutrition_need {

		int Age;
		double Height;
		double Weight;
		String Exercise;
		boolean Gender;				// True for male
		
		private double EnergyNeed;
		
		private double CarbohydratesNeed,ProteinNeed,FatNeed,SodiumNeed; // nutrition need

		nutrition_need() {
			Age = 18;
			Height = 170;
			Weight = 60;
			Exercise = "Sometimes";
			Gender = true;
			setUserNutritionNeed();
		}
		
		nutrition_need(int GivenAge, int GivenHeight, int GivenWeight, String GivenExercise, boolean GivenGender) {
			Age = GivenAge;
			Height = GivenHeight;
			Weight = GivenWeight;
			Exercise = GivenExercise;
			Gender = GivenGender;
			setUserNutritionNeed();
		}

		private void setEnergyNeed()
		{
			double ibw = Height * Height * 22 / 10000;
			double ratio = Weight / ibw;
			
			double x;
			
			if (ratio <=0.9)
				x = ibw * 35;
			else if (ratio >= 1.1)
				x = ibw * 25;
			else 
				x = ibw * 30;
			
			double y;
			if (18 <= Age && Age <= 29)
			{
				y = x + 300;
				if (!Gender)
					y -= 200;
			}
			else if (30 <= Age && Age <= 59)
			{
				y = x + 250;
				if (!Gender)
					y -= 200;
			}
			else
			{
				y = x;
				if (!Gender)
					y -= 100;
			}
			
			double Cal_n;
			if (Exercise=="Always")
				Cal_n =  y + 600;
			else if (Exercise=="Sometimes")
				Cal_n =  y + 300;
			else 
				Cal_n =  y;
			
			EnergyNeed = Math.round(Cal_n * 10) / 10.0;
		}
		
		public double getEnergyNeed()
		{
			return EnergyNeed;
		}
		
		private void setCarbohydratesNeed()
		{
			CarbohydratesNeed = Math.round((EnergyNeed * 0.65 / 4) * 10) / 10.0;
		}
		
		public double getCarbohydratesNeed()
		{
			return CarbohydratesNeed ;
		}
		
		private void setProteinNeed()
		{
			ProteinNeed = Math.round((EnergyNeed * 0.15 / 4) * 10) / 10.0;
		}
		
		public double getProteinNeed()
		{
			return ProteinNeed;
		}
		
		private void setFatNeed()
		{
			FatNeed =  Math.round((EnergyNeed * 0.2 / 9) * 10) / 10.0;
		}
		
		public double getFatNeed()
		{
			return FatNeed;
		}
		
		private void setSodiumNeed()
		{
			SodiumNeed = 2;
		}
		
		public double getSodiumNeed()
		{
			return SodiumNeed;
		}
		
		public void setUserNutritionNeed()
		{
			setEnergyNeed();
			setCarbohydratesNeed();
			setProteinNeed();
			setFatNeed();
			setSodiumNeed();
		}
}